{% extends 'base_ajgl.html' %}
{% load staticfiles %}
{% block title %}
    <title>结案信息上报</title>
{% endblock %}
{% block css %}
    <link rel="stylesheet" href="{% static 'bootstrap-fileinput-master/css/fileinput.min.css' %}">
    <script src="{% static 'bootstrap-fileinput-master/js/fileinput.js' %}"></script>
    <script src="{% static 'bootstrap-fileinput-master/js/locales/zh.js' %}"></script>
    <style>
        #id_aj_wfss {
            resize: none;
            text-indent: 2em;
        }

        .file-drop-zone-title {
            padding: 30px 10px;
        }
    </style>
{% endblock %}
{% block body %}
    <div class="container" style="padding: 0px">
        <form action="" method="post" novalidate>
            {% csrf_token %}
            <div class="panel panel-info">
                <div class="panel-heading" data-toggle="collapse" data-parent="#accordion" href="#collapse1">
                    立案信息上报
                </div>
                <div id="collapse1" class="panel-collapse collapse">
                    <div class="panel-body">
                        <div class="form-group col-md-3 {% if obj.aj_xingzhi.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_xingzhi">{{ obj.aj_xingzhi.label }}</label>
                            {{ obj.aj_xingzhi }}
                            <span class="help-block">{{ obj.aj_xingzhi.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-3 {% if obj.aj_zhonglei.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_zhonglei">{{ obj.aj_zhonglei.label }}</label>
                            {{ obj.aj_zhonglei }}
                            <span class="help-block">{{ obj.aj_zhonglei.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-3 {% if obj.aj_sheanjine.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_sheanjine">{{ obj.aj_sheanjine.label }}</label>
                            {{ obj.aj_sheanjine }}
                            <span class="help-block">{{ obj.aj_sheanjine.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-3 {% if obj.aj_laiyuan.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_laiyuan">{{ obj.aj_laiyuan.label }}</label>
                            {{ obj.aj_laiyuan }}
                            <span class="help-block">{{ obj.aj_laiyuan.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-3 {% if obj.aj_time1.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_time1">{{ obj.aj_time1.label }}</label>
                            <input type="date" name="aj_time1" value="{{ obj.aj_time1.value|date:"Y-m-d" }}" id="id_aj_time1" class="form-control">
                            <span class="help-block">{{ obj.aj_time1.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-3 {% if obj.aj_dangshiren.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_dangshiren">{{ obj.aj_dangshiren.label }}</label>
                            {{ obj.aj_dangshiren }}
                            <span class="help-block">{{ obj.aj_dangshiren.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-3 {% if obj.aj_faren.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_faren">{{ obj.aj_faren.label }}</label>
                            {{ obj.aj_faren }}
                            <span class="help-block">{{ obj.aj_faren.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-3 {% if obj.aj_jigoudaima.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_jigoudaima">{{ obj.aj_jigoudaima.label }}</label>
                            {{ obj.aj_jigoudaima }}
                            <span class="help-block">{{ obj.aj_jigoudaima.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-6 {% if obj.aj_anyou.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_anyou">{{ obj.aj_anyou.label }}</label>
                            {{ obj.aj_anyou }}
                            <span class="help-block">{{ obj.aj_anyou.errors.0 }}</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel panel-info">
                <div class="panel-heading" data-toggle="collapse" data-parent="#accordion" href="#collapse2">
                    结案信息上报
                </div>
                <div id="collapse2" class="panel-collapse collapse in">
                    <div class="panel-body">
                        <div class="form-group col-md-3 {% if obj.aj_zhuangtai.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_zhuangtai">{{ obj.aj_zhuangtai.label }}</label>
                            {{ obj.aj_zhuangtai }}
                            <span class="help-block">{{ obj.aj_zhuangtai.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-3 {% if obj.aj_chufajine.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_chufajine">{{ obj.aj_chufajine.label }}</label>
                            {{ obj.aj_chufajine }}
                            <span class="help-block">{{ obj.aj_chufajine.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-3 {% if obj.aj_heiwodian.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_heiwodian">{{ obj.aj_heiwodian.label }}</label>
                            {{ obj.aj_heiwodian }}
                            <span class="help-block">{{ obj.aj_heiwodian.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-3 {% if obj.aj_time2.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_time2">{{ obj.aj_time2.label }}</label>
                            <input type="date" name="aj_time2" value="{{ obj.aj_time2.value|date:"Y-m-d" }}" id="id_aj_time2" class="form-control">
                            <span class="help-block">{{ obj.aj_time2.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-6 {% if obj.aj_juedingshu.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_juedingshu">{{ obj.aj_juedingshu.label }}</label>
                            {{ obj.aj_juedingshu }}
                            <span class="help-block">{{ obj.aj_juedingshu.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-6 {% if obj.aj_chufayiju.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_chufayiju">{{ obj.aj_chufayiju.label }}</label>
                            {{ obj.aj_chufayiju }}
                            <span class="help-block">{{ obj.aj_chufayiju.errors.0 }}</span>
                        </div>
                        <div class="form-group col-md-12 {% if obj.aj_wfss.errors.0 %}has-error{% endif %}">
                            <label for="id_aj_wfss">{{ obj.aj_wfss.label }}</label>
                            {{ obj.aj_wfss }}
                            <span class="help-block">{{ obj.aj_wfss.errors.0 }}</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-6 col-md-offset-3" style="text-align: center">
                    <button class="btn btn-info" type="reset"
                            style="margin:10px 10px 20px 10px;text-align: center">重置
                    </button>
                    <button class="btn btn-success" type="submit"
                            style="margin:10px 10px 20px 10px;text-align: center">提交
                    </button>
                </div>
            </div>
        </form>
    </div>
    <div class="col-md-8 col-md-offset-2" style="padding-bottom: 30px">
        <label class="control-label" for="fileinput">上传行政处罚决定书（案件移交函）</label>
        <input type="file" id="fileinput" name="pic" multiple/>
        {% for pic in pic_list %}
            <div class="col-md-12" style="margin-top: 15px">
                <img src="/media/{{ pic.pic}}" alt="" width=100%>
                <button pic_name="{{ pic.pic }}" pic_id="{{ pic.id }}" class="btn btn-danger pull-right del" style="margin-top: 8px">删除</button>
            </div>
        {% endfor %}
    </div>
{% endblock %}
{% block js %}
    <script>
        $("input:not(#user),select,textarea").addClass("form-control")
        $("#id_aj_time1,#id_aj_time2").attr("type", "date")
        $('#id_aj_zhuangtai option:eq(0)').remove()

        //消除错误提示
        $(":input").click(function () {
            $(this).next().text("");
            $(this).parents('div').removeClass("has-error")
        })


        $('#fileinput').fileinput({
            language: 'zh',
            uploadUrl: '/upload_jaws/{{ id }}/',
            showCaption: true,
            showUpload: true,
            showRemove: true,
            showClose: true,
            layoutTemplates: {
                //actionDelete: ''
            },
            browseClass: 'btn btn-primary',
            maxFileCount: 8,
            autoReplace: true,
            allowedFileTypes: ['image'],
            minImageWidth: 800,
            minImageHeight: 600,
            maxFileSize: 5120,

        });
        $("#fileinput").on("fileuploaded", function (event, data, previewId, index) {
            if (data.response.msg == 100) {
                location.reload()
            }
        });

    </script>
{% endblock %}
